package com.design.yjx.strategy;

/**
 * @author yuanjianxin
 * @date 2017/8/2 11:22
 */
public class Main {
    public static void main(String[] args) {
        Duck mallardDuck = new MallardDuck();
        mallardDuck.swim();
        mallardDuck.fly();
        mallardDuck.quack();
        mallardDuck.display();

        System.out.println("-------------");

        Duck modeDuck = new ModeDuck();
        modeDuck.swim();
        modeDuck.fly();
        modeDuck.quack();
        modeDuck.display();

        System.out.println("改变叫的方法后");
        modeDuck.setQuackBehavior(new Squeak());
        modeDuck.quack();
    }
}
